#include <iostream>
#include <cmath>
using namespace std;

int main() {
    double x,a,b,c,d,res;
    cin >> x >> a >> b >> c >> d;
    res = a * pow(x, 3) + b * pow(x, 2) + c * x + d;
    printf("%.7f", res);
    return 0;
}